<template>
	<view style="width: 92%;margin: 100rpx auto 30rpx;">
		<headerNav :isShowNav="false" :navRightIcon="false" leftIconColor="#fff" title="加入" title-color="#ffffff">
		</headerNav>
		<view style="width: 100%;">
			<u-radio-group
				v-model="radiovalue1"
				placement="column"
				@change="groupChange"
			>
				<view class="flex item-center list_item justify-between" v-for="(item,index) in list" :key='index' style="margin-bottom: 30rpx;position: relative;border-radius: 20rpx;" @click="dibu(index)">
					<view class="flex items-center">
						<image class="mr20" :src="item.main_image" style="width: 80rpx;height: 80rpx;display: block;"></image>
						<text class="fs34 c000">{{ item.title }}</text>
					</view>
					<u-radio
						:key="index"
						:label="item.title"
						:name="item.title"
						active-color="#1FB0AC"
						labelColor="#fff"
						labelSize="0"
						@change="radioChange(item.id)"
					>
					</u-radio>
					<!-- <view style="width: 428rpx;line-height: 50rpx;font-size: 38rpx;color: #000000;position: absolute;top: 50%;left: 250rpx;transform: translateY(-50%);font-weight: 600;letter-spacing: 3px;">
						{{item.title}}
					</view> -->
				</view>
			</u-radio-group>
		</view>
		<view @click="xia" style="width: 100%;height:80rpx;line-height: 80rpx;border-radius: 40rpx;color: #FFFFFF;text-align: center;font-size: 28rpx;background-color: #1fb0ac;margin-top: 80rpx;">
			下一步
		</view>
		<model ref="model"/>
	</view>
</template>

<script>
	export default{
		data(){
			return{
				tabindex:-1,
				list:[],
				radiovalue1:''
			}
		},
		onLoad() {
			this.qiye()
		},
		methods:{
			groupChange() {

			},
			radioChange(id) {
				this.list.forEach((item,index) => {
					if (item.id == id) {
						this.tabindex = index
					}
				})
			},
			// 企业匪类
			qiye:function(){
				this.post('api/firm_data/special','',true).then(res=>{
					console.log(res)
					if(res.code==1){
						let data = res.data
						// data.forEach((item,index) => {
						// 	if (index == 0) {
						// 		item.name = '常规企业'
						// 	} else if (index == 1) {
						// 		item.name = '个体工商户'
						// 	} else if (index == 2) {
						// 		item.name = '物流/加工企业'
						// 	}
						// })
						this.list=data
						console.log('%c [ this.list ]-62', 'font-size:13px; background:pink; color:#bf2c9f;', this.list)
					}
				})
			},
			dibu:function(index){
				this.tabindex=index
			},
			xia:function(){
				let that=this
				if(that.tabindex==-1){
					uni.showToast({
						title: '请选择企业类型',
						icon: "none",
						duration: 1000
					})
					return
				}
				this.post('api/client/info', '', true).then(res => {
					if(res.code==1){
						if(res.data.degree<100){
							this.$refs.model.open()
						}else{
							uni.navigateTo({
								url:that.list[that.tabindex].page_path
							})
						}
					}
				})

			}
		}
	}
</script>

<style lang="less">
	page {
		background-color: #F8F8F8 !important;
		font-family: Demibold;
	}
	.active{

	}
	.a{
		border: 2px solid #eef0f7;
	}
	.list_item {
		padding: 40rpx;
		background-color: #fff;
	}
</style>
